package com.example.withroadlogistics.MyRule;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;
import com.example.withroadlogistics.DemoInfo;
import com.example.withroadlogistics.MyTask.Historytransport;
import com.example.withroadlogistics.MyTask.Mytransport;
import com.example.withroadlogistics.R;
import com.example.withroadlogistics.until.DemoListAdapter;

/**
 * 作者：Administrator on 2020/2/16 0016 16:37
 * 邮箱：1415862429@qq.com
 */
public class RuleList extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menulist);//这个样式可以共用
        ListView demoList = (ListView) findViewById(R.id.mapList);
        // 添加ListItem，设置事件响应
        demoList.setAdapter(new DemoListAdapter(RuleList.this,DEMOS));//加载数组
        demoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> arg0, View v, int index, long arg3) {
                onListItemClick(index);
            }
        });
    }

    void onListItemClick(int index) { //监听列表菜单
        Intent intent;
        intent = new Intent(this, DEMOS[index].demoClass);
        this.startActivity(intent);
    }

    private static final DemoInfo[] DEMOS = {
            new DemoInfo(R.string.rule_no, R.string.rule_no_detail, RuleNo.class),//未处理的违章记录
            new DemoInfo(R.string.rule_yes, R.string.rule_yes_detail, RuleYes.class),//已处理的违章记录
    };
}
